@extends('layout.adminlayout')
@section('css')
<script src="/admin/js/metisMenu.min.js"></script>
<script src="/admin/js/custom.js"></script>
<link href="/admin/css/custom.css" rel="stylesheet">
<!-- <link href="/admin/css/styles.css" rel="stylesheet" /> -->
<link href="/admin/css/inserthtml.com.radios.min.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
	[id^=checkbox-11-]:checked+label:before{z-index: 0;}
	[id^=checkbox-11-]+label:before{z-index: 0;}
	[id^=checkbox-11-]+label{margin-right: 0;}
	.table-responsive > .table-bordered{border:1px solid #e0e0e0;}
	th,td{text-align: center;}
</style>
@endsection
@section('content')
<div class="tables">
	<div class="table-responsive bs-example widget-shadow">
		<h4>通知设置 :</h4>
		<table class="table table-bordered">
             <tbody>
			@if(!null==$data)
				@foreach($data as $k => $v)
						<tr>
						<th>&nbsp;</th>
						<td>&nbsp;</td>
						</tr>
					<tr> 
						<th>通知类型</th>
						<th scope="row">
							
							@if($v['id'] == 1)
								短信通知
							@endif
							@if($v['id']==2)
								语音通知
							@endif
							@if($v['id']==3)
								邮件通知
							@endif
						</th>
						<tr>
							<th>运营商</th>
							<th>{{$v['operator']}}</th>
						</tr>
						<tr>
							<th>通知区域</th>
						<th>
							<input type="checkbox" id="checkbox-11-4{{$v['id']}}" @if($v['noti_area'] == 1) checked @endif />
							<label for="checkbox-11-4{{$v['id']}}" style="width: 73px; height: 32px; line-height: 16px;text-align: center;"></label>
							<!-- @if($v['noti_area'] == 1)
								通知
							@else
								不通知
							@endif -->
						</th>
						</tr>
						<tr>
							<th>通知建筑</th>
							<th>
							<input type="checkbox" id="checkbox-11-5{{$v['id']}}"@if($v['noti_building'] == 1) checked @endif />
							<label for="checkbox-11-5{{$v['id']}}" style="width: 73px; height: 32px; line-height: 16px;text-align: center;"></label>
							<!-- @if($v['noti_building'] == 1)
								通知
							@else
								不通知
							@endif -->
						</th>
						</tr>
						<tr>
							<th>通知房间</th>
						<th>
							<input type="checkbox" id="checkbox-11-6{{$v['id']}}"@if($v['noti_room'] == 1) checked @endif />
							<label for="checkbox-11-6{{$v['id']}}" style="width: 73px; height: 32px; line-height: 16px;text-align: center;"></label>
							<!-- @if($v['noti_building'] == 1)
								通知
							@else
								不通知
							@endif -->
						</th>
						</tr>
						<!-- <td>{{$v['ortherwise']}}</td> -->
						<tr>
							<th>通知状态</th>
						<th>
							<input type="checkbox" id="checkbox-11-7{{$v['id']}}" name="" @if($v['status'] == 1) checked @endif />
							<label for="checkbox-11-7{{$v['id']}}" style="width: 73px; height: 32px; line-height: 16px;text-align: center;"></label>
							<!-- @if($v['status'] == 1)
								启用
							@endif -->
						</th>
						</tr>
					</tr>
				@endforeach
			@endif
			</tbody> 
		</table>
	</div>
</div>
<script>
	$('input').each(function(l){
		$('input:eq('+l+')').click(function(){
			if($(this).attr('checked')){
				$.get('/admin/noti/update?num='+l+'&val=0',function(str){
					alert(str);
				});
				$(this).removeAttr('checked');
			}else{
				$.get('/admin/noti/update?num='+l+'&val=1',function(str){
					alert(str);
				});
				$(this).attr('checked','true');
			}
		});
	});
</script>
@endsection
@section('lastjs')
<script src="/admin/js/modernizr.js"></script>
@endsection